{extend name="public/base"}
{block name="main"}
<div class="container" id="main">
    <div class="text-right">
        <button class="btn btn-primary btn-sm"><a href="{:url('album/add')}">图片上传</a></button> <button class="btn btn-primary btn-sm"><a href="{:url('album/create')}">创建相册</a> </button>
    </div>
    <table class="table">
        <caption>我的相册</caption>
        <thead>
        <tr>
            <th>id</th>
            <th>主题</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>album
        <tbody>
        {volist name="list.list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.subject}</td>
            <td>{$vo.create_at|date="Y-m-d"}</td>
            <td><button class="btn btn-info" @click="view({$vo.id})" >查看</button>  <button class="btn btn-default"  @click="create({$vo.id})" >修改</button>  <button class="btn btn-danger" @click="del({$vo.id})">删除</button></td>

        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$list.page|raw}</div>
</div>
<script>
    new Vue({
        el:'#main',
        methods:{
            view:function(id){
                window.location.href='./view?id='+id;
            },
            create:function(id){
                window.location.href='./create?id='+id;
            },
            del:function(id){
                if(confirm("确定要删除文章么")){
                    var url = "{:url('album/delete')}";
                    var data = {'id':id};
                    ajax(url,data,'GET',function(re){
                        if(re.status == 1){
                            window.location.reload();
                        }
                    });
                };
            },
        }
    })
</script>
{/block}

